<?php
$imdb = 'http://www.imdb.com/';
$search = 'find?s=all&q=';
$title = 'title/';
$movies[] = 'tt0386032';
$movies[] = 'tt0443701';

function get_html($url) {
	$handle = fopen($url, "rb");
	$contents = stream_get_contents($handle);
	fclose($handle);
	return $contents;
}

function get_s_results($s_string) {
global $imdb;
global $search;	
$results = get_html($imdb . $search . $s_string);
	return $results;
}

function parse($html) {
$pattern = 'Titles \(Exact Matches\)(.+)<a href="/title/tt(.+)/">(.+)</a> \((.+)\)</td>(.+)';
$found = ereg($pattern, $html, $matches);
print_r($matches);
}
parse(get_s_results($_GET['movie']));

?>
